<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
        <?php
        include "includes/ketnoi.php";
        include "includes/header.php";
        ?>
        <style type="text/css">
            .example{
                margin: 20px;
            }
            
        </style>
    </head>
    <body>
        <?php
        // put your code here
        include "includes/narbar.php";
        ?>
        <?php
         $con = mysql_connect("localhost", "root", "");
         mysql_select_db("timviec", $con);
         mysql_query("set names'UTF8'");
         $sodu_lieu = mysql_num_rows(mysql_query("SELECT * FROM jobs ") ) or die(mysql_error());
         $SoBaiTrenTrang = 10;
         $sotrang = floor($sodu_lieu/$SoBaiTrenTrang) +1;      
         if ( !isset($_GET['page']) )
         {
             $_GET['page'] = 1 ;
         }
        $BatDau=( $_GET['page']-1)*$SoBaiTrenTrang;
        $result =mysql_query("SELECT * FROM jobs LIMIT $BatDau,$SoBaiTrenTrang") or die(mysql_error());
        ?>      
        <div class="container">
        <div class="row">
            <h2 class="text-center"> DANH SÁCH CV </h2>; 
        </div>
        <div class="row">
           <div class="text-center">
             <?php
            if($_GET['page']>1)
            {
                echo '<a href="ShowListJobs.php?page='.($_GET['page']-1).'">Back&nbsp;&nbsp;</a>';
            }
            for ( $ViTri = 1; $ViTri<= $sotrang;  $ViTri++ )
            {
                if($ViTri== $_GET['page'])
                {
                    echo '<font style="color: #d62c1a">&nbsp;&nbsp;'.$ViTri.'&nbsp;&nbsp;</font>';
                }
                else 
                {
                    if($ViTri!=$sotrang)
                    {
                        echo '<a href="ShowListJobs.php?page='.$ViTri.'">'.$ViTri.'</a>';
                    }                    
                }
            }
             if($_GET['page']<$sotrang)
            {
                echo '<a href="ShowListJobs.php?page='.($_GET['page']+1).'">&nbsp;&nbsp;Next</a>';
            }
        ?>
        </div>
        </div>
        <div class="row">
        <table class="table table-striped">
        <thead>
            <tr style="background-color: infobackground">
                <td>STT</td>
                <th>Mã CV</th>
                <th>Tên CV</th>
                <th>Mô Tã</th>
                <th class="text-center">Edit</th>
            </tr>
        </thead>
        <?php
        $STT=1;
        while ($row = mysql_fetch_array($result)) {?>
        <tr>
            <td><?php echo $STT++?></td>
            <td><?php echo $row["branch_id"]?></td>
            <td><?php echo $row["title"];?></td>  
            <td><a href="ChiTietCongViec.php?id=<?php echo $row["id"];?>">chi tiet</a></td>
            <td class="text-center"> <button type="button" name="btnXoa" class="btn-sm">Xóa</button> <button type="button" name="btnSua" class="btn-sm">Sửa</button></td>
            </tr>        
        <?php }mysql_close($con)?>
        </table>
        </div>
        </div>      
    </body>
    <?php
include "includes/footer.php";
?>
</html>
